option_expand.js ➔ getXML   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 12
rs 9.9
cc 2
1
/*
2
 * *****************************************************************************
3
 * Contributions to this work were made on behalf of the GÉANT project, a 
4
 * project that has received funding from the European Union’s Framework 
5
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
6
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
7
 * 691567 (GN4-1) and No. 731122 (GN4-2).
8
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
9
 * of the copyright in all material which was developed by a member of the GÉANT
10
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
11
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
12
 * UK as a branch of GÉANT Vereniging.
13
 * 
14
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
15
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
16
 *
17
 * License: see the web/copyright.inc.php file in the file structure or
18
 *          <base_url>/copyright.php after deploying the software
19
 */
20
21
/* General function for doing HTTP XML GET requests. */
22
23
function getXML(attribute_class, fedid, device) {
24
    console.log("Device="+device);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
25
    var client = new XMLHttpRequest();
26
    client.attribute_class = attribute_class;
27
    client.onreadystatechange = addOption;
28
    if (device === undefined) {
29
        client.open("GET", "inc/option_xhr.inc.php?class=" + attribute_class + "&fedid="+ fedid + "&etype=XML");
30
    } else {
31
        client.open("GET", "inc/option_xhr.inc.php?class=" + attribute_class + "&fedid="+ fedid + "&etype=XML&device="+device);
32
    }
33
    client.send();
34
}
35
36
function addOption() {
37
    if (this.readyState === 4 && this.status === 200) {
38
        var field = document.getElementById("expandable_" + this.attribute_class + "_options");
39
        var div = document.createElement('tbody');
40
        div.innerHTML = this.responseText;
41
        field.appendChild(div.firstChild);
42
    }
43
}
44
45
function processCredentials() {
46
    if (this.readyState === 4 && this.status === 200) {
47
        var field = document.getElementById("disposable_credential_container");
48
        field.innerHTML = this.responseText;
49
    }
50
}
51
52
function doCredentialCheck(form) {
53
    postXML(processCredentials, form);
54
}
55
56
function deleteOption(identifier) {
57
    var field = document.getElementById(identifier);
58
    field.parentNode.removeChild(field);
59
}
60
61
function MapGoogleDeleteCoord(e) {
62
    marks[e - 1].setOptions({visible: false});
63
}